﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLTouch.Service.DataContracts;
using SQLTouch.Service.ServiceContracts;

namespace SQLTouch.Service.Proxies
{
    public class TouchProxy : ITouchService
    {
        private readonly string uri;

        public TouchProxy(string uri)
        {
            this.uri = uri;
        }

        public SchemaData GetSchema(string connectionString)
        {
            using (Proxy<ITouchService> proxy = new Proxy<ITouchService>(uri))
            {
                return proxy.Channel.GetSchema(connectionString);
            }
        }

        public QueryResultData GetQueryResult(string connectionString, QueryData query)
        {
            using (Proxy<ITouchService> proxy = new Proxy<ITouchService>(uri))
            {
                return proxy.Channel.GetQueryResult(connectionString, query);
            }
        }
    }
}
